#ifndef AC_COMMON_MATRIX_HPP_
#define AC_COMMON_MATRIX_HPP_

#include <vector>

class ShortMatrix
{
public:
    void init(int sx, int sy, short* d)
    {
        x_size = sx;
        y_size = sy;
        data = d;
    }

    ShortMatrix() {}
    ShortMatrix(int sx, int sy, short* d)
    {
        init(sx, sy, d);
    }

    short operator() (int x, int y) const
    {
        return data[x + y * x_size];
    }

    short& operator() (int x, int y)
    {
        return data[x + y * x_size];
    }

private:
    int     x_size;
    int     y_size;
    short*  data;
};

#endif  // AC_COMMON_MATRIX_HPP_
